import {useMenusStore} from '@/stores/menus';
import {permisson} from './permisson';

export default {
    install(app) {
        console.log('app.config.globalProperties ====>', app.config.globalProperties);
        const menusStore = useMenusStore()
        
        app.directive('permission', {
            mounted(el, binding) {
                // console.log(menusStore.btnsPremissan, el, binding);
                
                if (!menusStore.btnsPremissan.includes(binding.value)) {
                el.style.display = 'none'
                // 或者直接移除元素
                // el.parentNode.removeChild(el)
                }
            }
        })

        app.directive('permisson-v2', permisson())
        
    }
}